<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>管理后台</title>
    <link rel="stylesheet" href="/static/plugins/layui/css/layui.css">
    <link rel="stylesheet" href="/static/admin/css/style.css">

    <script src="/static/plugins/layui/layui.js"></script>
    <script>
        //JavaScript代码区域
        layui.use('element', function(){
            var element = layui.element;

        });
    </script>
    <script src="/static/plugins/layui/js/jquery.min.js"></script>
</head>
<body>
{if $mobile==false }
<div id="video_wrapper">
    <video autoplay muted loop>
        <source src="/static/admin/coverr/Nature-Sunset.mp4" type="video/mp4">
    </video>
</div>
<style>
    #video_wrapper {
        margin: 0px;
        padding: 0px;
    }

    #video_wrapper video {
        position: fixed;
        top: 50%;
        left: 50%;
        z-index: -100;
        min-width: 100%;
        min-height: 100%;
        width: auto;
        height: auto;
        transform: translate(-50%, -50%);
    }
</style>
{/if}
<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login">

    <div class="layadmin-user-login-main">
        <div class="layadmin-user-login-box layadmin-user-login-header">
            <h2>管理后台</h2>
        </div>
        <form action="">
        <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
                <input type="text" name="username" id="LAY-user-login-username" lay-verify="required" placeholder="用户名" class="layui-input">
            </div>
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
                <input type="password" name="password" id="LAY-user-login-password" lay-verify="required" placeholder="密码" class="layui-input">
            </div>
            <div class="layui-form-item">
                <button  class="layui-btn layui-btn-fluid login" lay-submit lay-filter="LAY-user-login-submit">登 录</button>
            </div>

            <div class="layui-trans layadmin-user-login-footer">

                <p>©</p>
            </div>
        </div>
        </form>
    </div>
</div>
<script>
    $(document).keyup(function(event){
        if(event.keyCode ==13){
            $(".login").trigger("click");
        }
    });
    $(function() {
        //刷新验证码操作
        $(".layadmin-user-login-codeimg").click(function () {
            $(this).attr("src", $(this).attr("src") + '?' + Math.random());
        });
    });



        //后台登录
    //     $(".login").click(function(){
    //         var username = $("input[name='username']").val();
    //         var password = $("input[name='password']").val();
    //         var vercode  = $("input[name='vercode']").val();
    //         $.ajax({
    //             type: "post",
    //             url: "{:url('checkLogin')}",
    //             data: {username:username,password:password,vercode:vercode},
    //             dataType: "json",
    //             success: function(data){
    //                 if(data.error == 1){
    //                     alert(data.msg);
    //                 }else{
    //                     window.location.href = data.href;
    //                 }
    //             },
    //             error :function (xhr) {
    //             }
    //         });
    //
    //     })
    // })

</script>
<script src="/static/lib/layer/layer.js" type="text/javascript"></script>
<script>
    $(function () {
        $('.login').click(function () {
            $.ajax({
                url:"{:url('admin/index/login')}",
                type:"post",
                data:$('form').serialize(),
                dataType:'json',
                success:function(data) {
                    if(data.code == 1)
                    {
                        layer.msg(data.msg,{
                            icon:6,
                            time:2000
                        },function () {
                            location.href = data.url;
                        })
                    }else
                    {
                        layer.open(
                            {
                                title:'登陆失败哦！',
                                content:data.msg,
                                icon:5,
                                anim:6
                            }
                        );
                    }
                }
            });
            return false;
        })
    })
</script>
</body>
</html>